#include<stdio.h>
#define ROWS 2
#define COLUS 12

void Print_labAvg(double a[],int s);
void Print_StudentAvg(double a[],int s);
void stude_degre(int a[][COLUS], int rows, int cols);
void StudentAvg(int a[][COLUS], int rows, int cols,double avg[]);
void labAvg(int a[][COLUS], int rows, int cols,double lavg[]);

int main (void)
{
       int labScores[ROWS][COLUS],i,j,row=4,col=12,r=4,m=12;
       double s_avg[row],l_avg[col];
       FILE *infile;
       infile=fopen("input.txt","r");
//-----------------------------------      
       // To fill the 2D array 
       for (i=0; i<row; i++)
       for (j=0; j<col; j++)
       fscanf(infile,"%d", &labScores[i][j]); 
//-----------------------------------
stude_degre(labScores,row,col);
StudentAvg(labScores,row,col,s_avg);
Print_StudentAvg(s_avg,row);
labAvg(labScores,row,col,l_avg);
Print_labAvg(labScores,);
       

    
    system("pause");
    return 0;
}

void stude_degre(int a[][COLUS], int rows, int cols){
int i,j;
for(i=0;i<ROWS;i++)

for (j=0;j<COLUS;j++)

printf("%f", a[i][j]);


     printf("\n");
     }

void StudentAvg(int a[][COLUS], int rows, int cols,double avg[]){

double sum=0;
int i,j;
for (i=0;i<ROWS;i++) 
{
for (j=0;j<COLUS;j++)
sum = sum + a[i][j];
avg[i] = sum / COLUS;
}



}

void Print_StudentAvg(double a[],int s){

int i;
	for (i=0 ; i<s ; i++)
	printf ("%f",a[i]);
	printf ("\n");



     }

void labAvg(int a[][COLUS], int rows, int cols,double lavg[]){
     
double sum=0;
int i,j;
for (j=0;j<COLUS;j++) 
{
for (i=0;i<ROWS;i++)
sum = sum + a[i][j];
lavg[j] = sum / ROWS;
}

}

void Print_labAvg(double a[],int s){

int j;
	for (j=0 ; j<s ; j++)
	printf ("%f",a[j]);
	printf ("\n");



     }
